<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>闭包的生命周期</title>
</head>
<body>
    <script>

        function foo(){
            var num = 12;

            function fee(){
                console.log(num);
            }

            return fee;
        }


        foo()();//闭包刚产生就死亡，因为没有变量接收它
        
        var res =foo();
        res();//同理

        var rty = foo();
        var zoo = rty()//会一直存在

        zoo = null; //释放死亡



    </script>
</body>
</html>